

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  <meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>radosgw -- rados REST 风格的网关 &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/css/custom.css" type="text/css" />

  
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
        <script src="../../../_static/jquery.js"></script>
        <script src="../../../_static/_sphinx_javascript_frameworks_compat.js"></script>
        <script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js"></script>
        <script src="../../../_static/doctools.js"></script>
        <script src="../../../_static/sphinx_highlight.js"></script>
    
    <script type="text/javascript" src="../../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../../genindex/" />
    <link rel="search" title="Search" href="../../../search/" />
    <link rel="next" title="radosgw-admin -- rados REST 网关的用户管理工具" href="../radosgw-admin/" />
    <link rel="prev" title="故障排除" href="../../../radosgw/troubleshooting/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="../../../" class="icon icon-home" aria-label="Home"></a></li>
          <li class="breadcrumb-item"><a href="../../../radosgw/">Ceph 对象网关</a></li>
      <li class="breadcrumb-item active">radosgw -- rados REST 风格的网关</li>
      <li class="wy-breadcrumbs-aside">
            <a href="../../../_sources/man/8/radosgw.rst.txt" rel="nofollow"> View page source</a>
      </li>
  </ul>
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../../" class="icon icon-home"> Ceph
          

          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../../start/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephadm/">Cephadm</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../rados/">Ceph 存储集群</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephfs/">Ceph 文件系统</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../../radosgw/">Ceph 对象网关</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/frontends/">HTTP 前端</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/multisite/">多站配置</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/zone-features/">域的功能</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/placement/">存储池归置与存储类</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/multisite-sync-policy/">多站同步策略配置</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/pools/">存储池的配置</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/config-ref/">配置参考</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/admin/">管理指南</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/account/">用户账户</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/s3/">S3 API</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/iam/">IAM API</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/rgw-cache/">数据缓存和 CDN</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/swift/">Swift API</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/adminops/">管理操作 API</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/api/">Python 接口</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/nfs/">通过 NFS 导出</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/keystone/">与 OpenStack Keystone 对接</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/barbican/">与 OpenStack Barbican 对接</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/vault/">与 HashiCorp Vault 对接</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/kmip/">与 KMIP 对接</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/opa/">与 Open Policy Agent 对接</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/multitenancy/">多租户</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/compression/">压缩</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/ldap-auth/">LDAP 认证</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/encryption/">服务器端加密</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/bucketpolicy/">桶策略</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/dynamicresharding/">动态的桶索引重分片</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/mfa/">多因子认证</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/sync-modules/">同步模块</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/notifications/">Bucket Notifications</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/layout/">RADOS 中的数据布局</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/STS/">STS</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/STSLite/">STS Lite</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/keycloak/">Keycloak</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/session-tags/">Session Tags</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/role/">Role</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/orphans/">Orphan List and Associated Tooliing</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/oidc/">OpenID Connect Provider</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/troubleshooting/">故障排除</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">radosgw 手册页</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#id1">提纲</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id2">描述</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id3">选项</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id4">配置</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id5">记录使用日志</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id6">使用范围</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id7">参考</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../radosgw-admin/">radosgw-admin 手册页</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/qat-accel/">使用 QAT 为加密和压缩提速</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/s3select/">S3-select</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/lua-scripting/">Lua Scripting</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/d3n_datacache/">D3N Data Cache</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/cloud-transition/">Cloud Transition</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/metrics/">Metrics</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/uadk-accel/">UADK Acceleration for Compression</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../radosgw/bucket_logging/">桶的日志记录</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../monitoring/">监控概览</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../hardware-monitoring/">硬件监控</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <section id="radosgw-rados-rest">
<h1>radosgw -- rados REST 风格的网关<a class="headerlink" href="#radosgw-rados-rest" title="Permalink to this heading"></a></h1>
<section id="id1">
<h2>提纲<a class="headerlink" href="#id1" title="Permalink to this heading"></a></h2>
<div class="line-block">
<div class="line"><strong>radosgw</strong></div>
</div>
</section>
<section id="id2">
<h2>描述<a class="headerlink" href="#id2" title="Permalink to this heading"></a></h2>
<p><strong class="program">radosgw</strong> 是 RADOS 对象存储的一个 HTTP REST 网关，
是 Ceph 分布式存储系统的一部分。
它是用 libfcgi 实现的一个 FastCGI 模块，
可联合任何支持 FastCGI 功能的网页服务器使用。</p>
</section>
<section id="id3">
<h2>选项<a class="headerlink" href="#id3" title="Permalink to this heading"></a></h2>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-radosgw-c">
<span id="cmdoption-radosgw-conf"></span><span class="sig-name descname"><span class="pre">-c</span></span><span class="sig-prename descclassname"> <span class="pre">ceph.conf</span></span><span class="sig-prename descclassname"><span class="pre">,</span> </span><span class="sig-name descname"><span class="pre">--conf</span></span><span class="sig-prename descclassname"><span class="pre">=ceph.conf</span></span><a class="headerlink" href="#cmdoption-radosgw-c" title="Permalink to this definition"></a></dt>
<dd><p>用指定的 <code class="docutils literal notranslate"><span class="pre">ceph.conf</span></code> 配置文件而非默认的 <code class="docutils literal notranslate"><span class="pre">/etc/ceph/ceph.conf</span></code> 来确定启动时所需的监视器地址。</p>
</dd></dl>

<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-radosgw-m">
<span class="sig-name descname"><span class="pre">-m</span></span><span class="sig-prename descclassname"> <span class="pre">monaddress[:port]</span></span><a class="headerlink" href="#cmdoption-radosgw-m" title="Permalink to this definition"></a></dt>
<dd><p>连接到指定监视器，而非通过 <code class="docutils literal notranslate"><span class="pre">ceph.conf</span></code> 查询。</p>
</dd></dl>

<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-radosgw-i">
<span id="cmdoption-radosgw-id"></span><span class="sig-name descname"><span class="pre">-i</span></span><span class="sig-prename descclassname"> <span class="pre">ID</span></span><span class="sig-prename descclassname"><span class="pre">,</span> </span><span class="sig-name descname"><span class="pre">--id</span></span><span class="sig-prename descclassname"> <span class="pre">ID</span></span><a class="headerlink" href="#cmdoption-radosgw-i" title="Permalink to this definition"></a></dt>
<dd><p>设置 radosgw 名字的 ID 部分。</p>
</dd></dl>

<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-radosgw-n">
<span id="cmdoption-radosgw-name"></span><span class="sig-name descname"><span class="pre">-n</span></span><span class="sig-prename descclassname"> <span class="pre">TYPE.ID</span></span><span class="sig-prename descclassname"><span class="pre">,</span> </span><span class="sig-name descname"><span class="pre">--name</span></span><span class="sig-prename descclassname"> <span class="pre">TYPE.ID</span></span><a class="headerlink" href="#cmdoption-radosgw-n" title="Permalink to this definition"></a></dt>
<dd><p>设置网关的 rados 用户名（如 client.radosgw.gateway ）。</p>
</dd></dl>

<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-radosgw-cluster">
<span class="sig-name descname"><span class="pre">--cluster</span></span><span class="sig-prename descclassname"> <span class="pre">NAME</span></span><a class="headerlink" href="#cmdoption-radosgw-cluster" title="Permalink to this definition"></a></dt>
<dd><p>设置集群名称（默认： ceph ）</p>
</dd></dl>

<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-radosgw-d">
<span class="sig-name descname"><span class="pre">-d</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-radosgw-d" title="Permalink to this definition"></a></dt>
<dd><p>在前台运行，日志记录到标准错误</p>
</dd></dl>

<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-radosgw-f">
<span class="sig-name descname"><span class="pre">-f</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-radosgw-f" title="Permalink to this definition"></a></dt>
<dd><p>在前台运行，日志记录到正常位置</p>
</dd></dl>

<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-radosgw-rgw-socket-path">
<span class="sig-name descname"><span class="pre">--rgw-socket-path</span></span><span class="sig-prename descclassname"><span class="pre">=path</span></span><a class="headerlink" href="#cmdoption-radosgw-rgw-socket-path" title="Permalink to this definition"></a></dt>
<dd><p>指定 Unix 域套接字的路径</p>
</dd></dl>

<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-radosgw-rgw-region">
<span class="sig-name descname"><span class="pre">--rgw-region</span></span><span class="sig-prename descclassname"><span class="pre">=region</span></span><a class="headerlink" href="#cmdoption-radosgw-rgw-region" title="Permalink to this definition"></a></dt>
<dd><p>radosgw 所在 region</p>
</dd></dl>

<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-radosgw-rgw-zone">
<span class="sig-name descname"><span class="pre">--rgw-zone</span></span><span class="sig-prename descclassname"><span class="pre">=zone</span></span><a class="headerlink" href="#cmdoption-radosgw-rgw-zone" title="Permalink to this definition"></a></dt>
<dd><p>radosgw 所在的区域</p>
</dd></dl>

</section>
<section id="id4">
<h2>配置<a class="headerlink" href="#id4" title="Permalink to this heading"></a></h2>
<p>先前的 RADOS 网关配置依赖 <code class="docutils literal notranslate"><span class="pre">Apache</span></code> 和 <code class="docutils literal notranslate"><span class="pre">mod_fastcgi</span></code> ；
现在则用 <code class="docutils literal notranslate"><span class="pre">mod_proxy_fcgi</span></code> 替换了 <code class="docutils literal notranslate"><span class="pre">mod_fastcgi</span></code> ，
<code class="docutils literal notranslate"><span class="pre">mod_proxy_fcgi</span></code> 的工作方式不同于传统的 FastCGI 模块，
它需要 <code class="docutils literal notranslate"><span class="pre">mod_proxy</span></code> 模块所支持的 FastCGI 协议。
所以，要处理 FastCGI 协议，服务器需同时有
<code class="docutils literal notranslate"><span class="pre">mod_proxy</span></code> 和 <code class="docutils literal notranslate"><span class="pre">mod_proxy_fcgi</span></code> 模块。
不像 <code class="docutils literal notranslate"><span class="pre">mod_fastcgi</span></code> ， <code class="docutils literal notranslate"><span class="pre">mod_proxy_fcgi</span></code> 不能启动应用进程。
某些平台提供了 <code class="docutils literal notranslate"><span class="pre">fcgistarter</span></code> 来实现此功能。
然而， FastCGI 应用框架有可能具备外部启动或进程管理功能。</p>
<p><code class="docutils literal notranslate"><span class="pre">Apache</span></code> 可以通过本机 TCP 连接或 Unix 域套接字使用
<code class="docutils literal notranslate"><span class="pre">mod_proxy_fcgi</span></code> 模块。不支持 Unix 域套接字的 <code class="docutils literal notranslate"><span class="pre">mod_proxy_fcgi</span></code> ，
像 Apache 2.2 和 2.4 的早期版本，
必需通过本机 TCP 连接。
之后的 Apache （如 2.4.9 ）以及更高版本支持 unix 域套接字，
因此它们支持 unix 域套接字配置、而非本机 TCP 。</p>
<p>下面的步骤展示了一些配置文件内容，
有 Ceph 配置文件 <code class="docutils literal notranslate"><span class="pre">/etc/ceph/ceph.conf</span></code> ，
和网关配置文件 <code class="docutils literal notranslate"><span class="pre">/etc/httpd/conf.d/rgw.conf</span></code> （基于 RPM 的发行版），
或者 <code class="docutils literal notranslate"><span class="pre">/etc/apache2/conf-available/rgw.conf</span></code> （基于 Debian 的发行版），
本机 TCP 和通过 unix 域套接字的配置都有：</p>
<ol class="arabic">
<li><p>对于搭载 Apache 2.2 以及 Apache 2.4 早期版本的发行版来说，
它们使用 TCP 且不支持 Unix 域套接字，
把下面的内容加进 <code class="docutils literal notranslate"><span class="pre">/etc/ceph/ceph.conf</span></code> 文件：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">client</span><span class="o">.</span><span class="n">radosgw</span><span class="o">.</span><span class="n">gateway</span><span class="p">]</span>
<span class="n">host</span> <span class="o">=</span> <span class="p">{</span><span class="n">hostname</span><span class="p">}</span>
<span class="n">keyring</span> <span class="o">=</span> <span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="n">ceph</span><span class="o">/</span><span class="n">ceph</span><span class="o">.</span><span class="n">client</span><span class="o">.</span><span class="n">radosgw</span><span class="o">.</span><span class="n">keyring</span>
<span class="n">rgw</span> <span class="n">socket</span> <span class="n">path</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span>
<span class="n">log</span> <span class="n">file</span> <span class="o">=</span> <span class="o">/</span><span class="n">var</span><span class="o">/</span><span class="n">log</span><span class="o">/</span><span class="n">ceph</span><span class="o">/</span><span class="n">client</span><span class="o">.</span><span class="n">radosgw</span><span class="o">.</span><span class="n">gateway</span><span class="o">.</span><span class="n">log</span>
<span class="n">rgw</span> <span class="n">frontends</span> <span class="o">=</span> <span class="n">fastcgi</span> <span class="n">socket_port</span><span class="o">=</span><span class="mi">9000</span> <span class="n">socket_host</span><span class="o">=</span><span class="mf">0.0.0.0</span>
<span class="n">rgw</span> <span class="nb">print</span> <span class="k">continue</span> <span class="o">=</span> <span class="n">false</span>
</pre></div>
</div>
</li>
<li><p>把下列内容加入网关配置文件：</p>
<p>在 Debian/Ubuntu 上，加入 <code class="docutils literal notranslate"><span class="pre">/etc/apache2/conf-available/rgw.conf</span></code></p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">&lt;</span><span class="n">VirtualHost</span> <span class="o">*</span><span class="p">:</span><span class="mi">80</span><span class="o">&gt;</span>
<span class="n">ServerName</span> <span class="n">localhost</span>
<span class="n">DocumentRoot</span> <span class="o">/</span><span class="n">var</span><span class="o">/</span><span class="n">www</span><span class="o">/</span><span class="n">html</span>

<span class="n">ErrorLog</span> <span class="o">/</span><span class="n">var</span><span class="o">/</span><span class="n">log</span><span class="o">/</span><span class="n">apache2</span><span class="o">/</span><span class="n">rgw_error</span><span class="o">.</span><span class="n">log</span>
<span class="n">CustomLog</span> <span class="o">/</span><span class="n">var</span><span class="o">/</span><span class="n">log</span><span class="o">/</span><span class="n">apache2</span><span class="o">/</span><span class="n">rgw_access</span><span class="o">.</span><span class="n">log</span> <span class="n">combined</span>

<span class="c1"># LogLevel debug</span>

<span class="n">RewriteEngine</span> <span class="n">On</span>

<span class="n">RewriteRule</span> <span class="o">.*</span> <span class="o">-</span> <span class="p">[</span><span class="n">E</span><span class="o">=</span><span class="n">HTTP_AUTHORIZATION</span><span class="p">:</span><span class="o">%</span><span class="p">{</span><span class="n">HTTP</span><span class="p">:</span><span class="n">Authorization</span><span class="p">},</span><span class="n">L</span><span class="p">]</span>

<span class="n">SetEnv</span> <span class="n">proxy</span><span class="o">-</span><span class="n">nokeepalive</span> <span class="mi">1</span>

<span class="n">ProxyPass</span> <span class="o">/</span> <span class="n">fcgi</span><span class="p">:</span><span class="o">//</span><span class="n">localhost</span><span class="p">:</span><span class="mi">9000</span><span class="o">/</span>

<span class="o">&lt;/</span><span class="n">VirtualHost</span><span class="o">&gt;</span>
</pre></div>
</div>
<p>在 CentOS/RHEL 上，加入 <code class="docutils literal notranslate"><span class="pre">/etc/httpd/conf.d/rgw.conf</span></code>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">&lt;</span><span class="n">VirtualHost</span> <span class="o">*</span><span class="p">:</span><span class="mi">80</span><span class="o">&gt;</span>
<span class="n">ServerName</span> <span class="n">localhost</span>
<span class="n">DocumentRoot</span> <span class="o">/</span><span class="n">var</span><span class="o">/</span><span class="n">www</span><span class="o">/</span><span class="n">html</span>

<span class="n">ErrorLog</span> <span class="o">/</span><span class="n">var</span><span class="o">/</span><span class="n">log</span><span class="o">/</span><span class="n">httpd</span><span class="o">/</span><span class="n">rgw_error</span><span class="o">.</span><span class="n">log</span>
<span class="n">CustomLog</span> <span class="o">/</span><span class="n">var</span><span class="o">/</span><span class="n">log</span><span class="o">/</span><span class="n">httpd</span><span class="o">/</span><span class="n">rgw_access</span><span class="o">.</span><span class="n">log</span> <span class="n">combined</span>

<span class="c1"># LogLevel debug</span>

<span class="n">RewriteEngine</span> <span class="n">On</span>

<span class="n">RewriteRule</span> <span class="o">.*</span> <span class="o">-</span> <span class="p">[</span><span class="n">E</span><span class="o">=</span><span class="n">HTTP_AUTHORIZATION</span><span class="p">:</span><span class="o">%</span><span class="p">{</span><span class="n">HTTP</span><span class="p">:</span><span class="n">Authorization</span><span class="p">},</span><span class="n">L</span><span class="p">]</span>

<span class="n">SetEnv</span> <span class="n">proxy</span><span class="o">-</span><span class="n">nokeepalive</span> <span class="mi">1</span>

<span class="n">ProxyPass</span> <span class="o">/</span> <span class="n">fcgi</span><span class="p">:</span><span class="o">//</span><span class="n">localhost</span><span class="p">:</span><span class="mi">9000</span><span class="o">/</span>

<span class="o">&lt;/</span><span class="n">VirtualHost</span><span class="o">&gt;</span>
</pre></div>
</div>
</li>
<li><p>对于搭载了支持 Unix 域套接字的 Apache 2.4.9 及更高版的发行版，可使用下列配置：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">client</span><span class="o">.</span><span class="n">radosgw</span><span class="o">.</span><span class="n">gateway</span><span class="p">]</span>
<span class="n">host</span> <span class="o">=</span> <span class="p">{</span><span class="n">hostname</span><span class="p">}</span>
<span class="n">keyring</span> <span class="o">=</span> <span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="n">ceph</span><span class="o">/</span><span class="n">ceph</span><span class="o">.</span><span class="n">client</span><span class="o">.</span><span class="n">radosgw</span><span class="o">.</span><span class="n">keyring</span>
<span class="n">rgw</span> <span class="n">socket</span> <span class="n">path</span> <span class="o">=</span> <span class="o">/</span><span class="n">var</span><span class="o">/</span><span class="n">run</span><span class="o">/</span><span class="n">ceph</span><span class="o">/</span><span class="n">ceph</span><span class="o">.</span><span class="n">radosgw</span><span class="o">.</span><span class="n">gateway</span><span class="o">.</span><span class="n">fastcgi</span><span class="o">.</span><span class="n">sock</span>
<span class="n">log</span> <span class="n">file</span> <span class="o">=</span> <span class="o">/</span><span class="n">var</span><span class="o">/</span><span class="n">log</span><span class="o">/</span><span class="n">ceph</span><span class="o">/</span><span class="n">client</span><span class="o">.</span><span class="n">radosgw</span><span class="o">.</span><span class="n">gateway</span><span class="o">.</span><span class="n">log</span>
<span class="n">rgw</span> <span class="nb">print</span> <span class="k">continue</span> <span class="o">=</span> <span class="n">false</span>
</pre></div>
</div>
</li>
<li><p>把下列内容加入网关配置文件中：</p>
<p>在 CentOS/RHEL 上，加入 <code class="docutils literal notranslate"><span class="pre">/etc/httpd/conf.d/rgw.conf</span></code>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">&lt;</span><span class="n">VirtualHost</span> <span class="o">*</span><span class="p">:</span><span class="mi">80</span><span class="o">&gt;</span>
<span class="n">ServerName</span> <span class="n">localhost</span>
<span class="n">DocumentRoot</span> <span class="o">/</span><span class="n">var</span><span class="o">/</span><span class="n">www</span><span class="o">/</span><span class="n">html</span>

<span class="n">ErrorLog</span> <span class="o">/</span><span class="n">var</span><span class="o">/</span><span class="n">log</span><span class="o">/</span><span class="n">httpd</span><span class="o">/</span><span class="n">rgw_error</span><span class="o">.</span><span class="n">log</span>
<span class="n">CustomLog</span> <span class="o">/</span><span class="n">var</span><span class="o">/</span><span class="n">log</span><span class="o">/</span><span class="n">httpd</span><span class="o">/</span><span class="n">rgw_access</span><span class="o">.</span><span class="n">log</span> <span class="n">combined</span>

<span class="c1"># LogLevel debug</span>

<span class="n">RewriteEngine</span> <span class="n">On</span>

<span class="n">RewriteRule</span> <span class="o">.*</span> <span class="o">-</span> <span class="p">[</span><span class="n">E</span><span class="o">=</span><span class="n">HTTP_AUTHORIZATION</span><span class="p">:</span><span class="o">%</span><span class="p">{</span><span class="n">HTTP</span><span class="p">:</span><span class="n">Authorization</span><span class="p">},</span><span class="n">L</span><span class="p">]</span>

<span class="n">SetEnv</span> <span class="n">proxy</span><span class="o">-</span><span class="n">nokeepalive</span> <span class="mi">1</span>

<span class="n">ProxyPass</span> <span class="o">/</span> <span class="n">unix</span><span class="p">:</span><span class="o">///</span><span class="n">var</span><span class="o">/</span><span class="n">run</span><span class="o">/</span><span class="n">ceph</span><span class="o">/</span><span class="n">ceph</span><span class="o">.</span><span class="n">radosgw</span><span class="o">.</span><span class="n">gateway</span><span class="o">.</span><span class="n">fastcgi</span><span class="o">.</span><span class="n">sock</span><span class="o">|</span><span class="n">fcgi</span><span class="p">:</span><span class="o">//</span><span class="n">localhost</span><span class="p">:</span><span class="mi">9000</span><span class="o">/</span>

<span class="o">&lt;/</span><span class="n">VirtualHost</span><span class="o">&gt;</span>
</pre></div>
</div>
<p>请注意， <code class="docutils literal notranslate"><span class="pre">Apache</span> <span class="pre">2.4.7</span></code> 不支持 Unix 域套接字，
所以必须配置成本机 TCP 。
Unix 域套接字支持存在于 <code class="docutils literal notranslate"><span class="pre">Apache</span> <span class="pre">2.4.9</span></code> 及其后续版本中。</p>
</li>
<li><p>给 radosgw 生成一个密钥，用于到集群认证。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span><span class="o">-</span><span class="n">authtool</span> <span class="o">-</span><span class="n">C</span> <span class="o">-</span><span class="n">n</span> <span class="n">client</span><span class="o">.</span><span class="n">radosgw</span><span class="o">.</span><span class="n">gateway</span> <span class="o">--</span><span class="n">gen</span><span class="o">-</span><span class="n">key</span> <span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="n">ceph</span><span class="o">/</span><span class="n">keyring</span><span class="o">.</span><span class="n">radosgw</span><span class="o">.</span><span class="n">gateway</span>
<span class="n">ceph</span><span class="o">-</span><span class="n">authtool</span> <span class="o">-</span><span class="n">n</span> <span class="n">client</span><span class="o">.</span><span class="n">radosgw</span><span class="o">.</span><span class="n">gateway</span> <span class="o">--</span><span class="n">cap</span> <span class="n">mon</span> <span class="s1">&#39;allow rw&#39;</span> <span class="o">--</span><span class="n">cap</span> <span class="n">osd</span> <span class="s1">&#39;allow rwx&#39;</span> <span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="n">ceph</span><span class="o">/</span><span class="n">keyring</span><span class="o">.</span><span class="n">radosgw</span><span class="o">.</span><span class="n">gateway</span>
</pre></div>
</div>
</li>
<li><p>把密钥导入集群。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">auth</span> <span class="n">add</span> <span class="n">client</span><span class="o">.</span><span class="n">radosgw</span><span class="o">.</span><span class="n">gateway</span> <span class="o">--</span><span class="ow">in</span><span class="o">-</span><span class="n">file</span><span class="o">=</span><span class="n">keyring</span><span class="o">.</span><span class="n">radosgw</span><span class="o">.</span><span class="n">gateway</span>
</pre></div>
</div>
</li>
<li><p>启动 Apache 和 radosgw 。</p>
<p>在 Debian/Ubuntu 上:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">sudo</span> <span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="n">init</span><span class="o">.</span><span class="n">d</span><span class="o">/</span><span class="n">apache2</span> <span class="n">start</span>
<span class="n">sudo</span> <span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="n">init</span><span class="o">.</span><span class="n">d</span><span class="o">/</span><span class="n">radosgw</span> <span class="n">start</span>
</pre></div>
</div>
<p>在 CentOS/RHEL 上:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">sudo</span> <span class="n">apachectl</span> <span class="n">start</span>
<span class="n">sudo</span> <span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="n">init</span><span class="o">.</span><span class="n">d</span><span class="o">/</span><span class="n">ceph</span><span class="o">-</span><span class="n">radosgw</span> <span class="n">start</span>
</pre></div>
</div>
</li>
</ol>
</section>
<section id="id5">
<h2>记录使用日志<a class="headerlink" href="#id5" title="Permalink to this heading"></a></h2>
<p><strong class="program">radosgw</strong> 会异步地维护使用率日志，
它会累积用户操作统计并周期性地刷回。
可用 <strong class="program">radosgw-admin</strong> 访问和管理日志。</p>
<p>记录的信息包括数据传输总量、
操作总量、成功操作总量。
这些数据是按小时记录到桶所有者名下的，
除非操作是针对服务的（如罗列桶时），
这时会记录到操作用户名下。</p>
<p>下面是个配置实例：</p>
<div class="highlight-ini notranslate"><div class="highlight"><pre><span></span><span class="k">[client.radosgw.gateway]</span>
<span class="na">rgw enable usage log</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">true</span>
<span class="na">rgw usage log tick interval</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">30</span>
<span class="na">rgw usage log flush threshold</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">1024</span>
<span class="na">rgw usage max shards</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">32</span>
<span class="na">rgw usage max user shards</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">1</span>
</pre></div>
</div>
<p>碎片总数决定着总共需要多少对象来保存使用日志信息。
每用户碎片数确定了为单个用户保存使用信息需多少对象。
tick interval 可配置刷回日志的间隔秒数，
flush threshold 决定了保留的日志条数达到多少才调用异步刷回。</p>
</section>
<section id="id6">
<h2>使用范围<a class="headerlink" href="#id6" title="Permalink to this heading"></a></h2>
<p><strong class="program">radosgw</strong> 是 Ceph 的一部分，这是个伸缩力强、开源、
分布式的存储系统，更多信息参见 <a class="reference external" href="https://docs.ceph.com">https://docs.ceph.com</a> 。</p>
</section>
<section id="id7">
<h2>参考<a class="headerlink" href="#id7" title="Permalink to this heading"></a></h2>
<p><a class="reference internal" href="../ceph/"><span class="doc">ceph</span></a>(8)
<a class="reference internal" href="../radosgw-admin/"><span class="doc">radosgw-admin</span></a>(8)</p>
</section>
</section>



<div id="support-the-ceph-foundation" class="admonition note">
  <p class="first admonition-title">Brought to you by the Ceph Foundation</p>
  <p class="last">The Ceph Documentation is a community resource funded and hosted by the non-profit <a href="https://ceph.io/en/foundation/">Ceph Foundation</a>. If you would like to support this and our other efforts, please consider <a href="https://ceph.io/en/foundation/join/">joining now</a>.</p>
</div>


           </div>
           
          </div>
          <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
        <a href="../../../radosgw/troubleshooting/" class="btn btn-neutral float-left" title="故障排除" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
        <a href="../radosgw-admin/" class="btn btn-neutral float-right" title="radosgw-admin -- rados REST 网关的用户管理工具" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).</p>
  </div>

   

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>